<template>
    <Layout>
        <Sider hide-trigger :style="{width: '240px','min-width':'240px','max-width':'240px', background: '#000'}">
            <Menu active-name="1-1" theme="light" width="auto" :open-names="['1']" :accordion="true">
                  <template v-for="(item,index) in menuList">
					  <template v-if="item.entity && item.entity.length>0">
							<Submenu :name="item.url" :key="index">	
								<template slot="title">
									<Icon type="ios-navigate"></Icon>
								     {{item.name}}
								</template>
								<MenuItem :name="v.url" :to="{name:v.url}" v-for="(v,i) in item.entity" :key="i">
								{{v.name}}</MenuItem>
							</Submenu>
						</template>
						<template v-else>
							<MenuItem :name="item.url" :to="{name:item.url}" :key="index">
								<Icon type="ios-navigate"></Icon>
								{{item.name}}
							</MenuItem>
						</template>
                </template>   
            </Menu>
        </Sider>
        <!-- 内容 -->
        <router-view class="content-router-view"/>
    </Layout>
</template>

<script>
    export default {
        name: "menuLeft",
        data() {
            return {
                menuList:[]
            };
        },
        mounted(){
            // 查询菜单
            this.queryMenu();
        },
        methods: {
            // 查询菜单
            queryMenu(){
                this.$http.post('/menu/pc/tree/list',{type:3}).then(res =>{
                    if(res.status == 200){
						if(res.data.code==200){
							this.menuList = res.data.data;
						}
                    }
                });
            }
        }
    }
</script>

<style >
.ivu-menu-light{
	background:#000 !important;
}
.ivu-menu{
	color: #fff !important;
}
.ivu-menu-light.ivu-menu-vertical .ivu-menu-item-active:not(.ivu-menu-submenu) {
    color: #2d8cf0;
    background: #d7dde4;
    z-index: 2;
}
</style>